class MusicsController < ApplicationController
  skip_before_filter :require_login,except: :create
  def index
    @music = Music.new
    @musics = Music.order(:created_at).page params[:page]
  end
  def create
    @song = Music.new(song_params)
    @song.user_id = current_user.id
    if @song.save()
      flash[:success] = "分享歌曲成功"
      redirect_to musics_path
    end
  end

  def song_params
    params.require(:music).permit(:title,:xiami_html)
  end
end
